
/**
 * 推送实验数据
 * topic格式为
 */

// server.js

const WebSocket = require('ws')
const connection = new WebSocket(connectUrl)
let myData = {...data}
connection.onopen = () => {
    
    myData.deviceNo =  deviceClient.deviceId;

  connection.send(JSON.stringify(myData)) 
}

connection.onerror = (error) => {
  console.log(`WebSocket error: ${error}`)
}

connection.onmessage = (e) => {
  console.log(e.data)
}

function publish() {
    console.log(89)
    myData.kitNo = getKits();;
    connection.send(JSON.stringify(myData)) 
}

